package com.hmall.client;

import com.hmall.common.dto.PageDTO;
import com.hmall.common.dto.RequestParams;
import com.hmall.common.pojo.Item;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * TODO
 *
 * @Author wangxinyi
 * @Date 2024/11/14 20:28
 */
@FeignClient("itemservice")
public interface ItemClient {
    /**
     * 过滤项聚合功能
     *
     * @return
     */
    @PostMapping("/item/filters")
    Map searchFilters(@RequestBody RequestParams requestParams);


    /**
     * 基本搜索功能
     *
     * @param requestParams
     * @return
     */
    @PostMapping("/item/searchList")
    PageDTO<Item> page(@RequestBody RequestParams requestParams);


    /**
     * 根据id查询商品
     */
    @GetMapping("/item/{id}")
    Item selectById(@PathVariable String id);




    /**
     * 扣减库存/恢复库存
     */
    @PutMapping("/item/stock/{itemId}/{num}")
    void stockNum(@PathVariable Long itemId,@PathVariable Integer num);



    @PutMapping("/item/{itemId}/{num}")
     void runNum(@PathVariable Long itemId,@PathVariable Integer num);

}
